﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SheepStorage.API.Application.Command.SheepFieldCommand;
using SheepStorage.API.Application.Command.SheepManagementCommand;
using SheepStorage.API.Baseclass;
using SheepStorage.Domain.Entity;
using SheepStorage.Service.Interface;

namespace SheepStorage.API.Controllers
{
    /// <summary>
    /// 栏位管理
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class SheepFieldController : ControllerBase
    {
        private readonly IMediator _mediator;
       

        public SheepFieldController(IMediator mediator)
        {
            _mediator = mediator;
            
        }

        /// <summary>
        /// 栏位添加
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Results<int>> Create(SheepFieldCreateCommand command)
        {
            return await _mediator.Send(command);
        }

        /// <summary>
        /// 栏位显示
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>

        [HttpPost]
        public async Task<Results<List<SheepField>>> GetSheepField(SheepFieldListCommand command)
        {
            return await _mediator.Send(command);
        }

    }
}
